package acwing._1_1AlgorithmBasic._5DynamicProgramming;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._5DynamicProgramming
 * @File : Q0895.java
 * @Author : WangRuoyu
 * @Date 2023/11/25 11:34
 */

public class Q0895 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int[] a = new int[n];
        line = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(line[i]);
        }

        int[] f = new int[n];
        int res = 0;
        for (int i = 0; i < n; i++) {
            f[i] = 1;
            for (int j = 0; j < i; j++) {
                if (a[i] > a[j]) f[i] = Math.max(f[i], f[j] + 1);
            }
            res = Math.max(res, f[i]);
        }

        System.out.println(res);
    }
}